home *** CD-ROM | disk | FTP | other *** search
/ Merciful 1 / Merciful - Disc 1.iso / software / r / rexx_plus_compiler / rexxpluscompiler2.dms / in.adf / RexxPlPlot / Examples / examples.zoo / Example03.plot < prev    next >
Encoding:
Text File  |  1990-03-17  |  1.2 KB  |  65 lines

  1. /* Example03.Plot - Illustration of 1-1 scaling for polar plot */
  2. /* Modified for RexxPlPlot by Glenn M. Lewis - 9/12/89 */
  3.  
  4. address 'PlPlot'
  5. say 'Please be patient...'
  6.  
  7.       dtr=3.141592654/180.0
  8.       do i=1 to 361
  9.         x0.i=cos(dtr*(i-1))
  10.         y0.i=sin(dtr*(i-1))
  11.       end i
  12.  
  13.       'plstar(1,1);'
  14.  
  15. /* Set up viewport and window, but do not draw box */
  16.  
  17.       'plenv(-1.3,1.3,-1.3,1.3,1,-2);'
  18.       do i=1 to 10
  19.         do j=1 to 361
  20.           x.j=0.1*i*x0.j
  21.           y.j=0.1*i*y0.j
  22.         end j
  23.  
  24. /* Draw circles for polar grid */
  25.  
  26.         'plline(361,x,y);'
  27.       end i
  28.  
  29.       do i=0 to 11
  30.         theta=30*i
  31.         dx=cos(dtr*theta)
  32.         dy=sin(dtr*theta)
  33.            minusdx=-dx
  34.            minusdy=-dy
  35.  
  36. /* Draw radial spokes for polar grid */
  37.  
  38.         'pljoin(0.0,0.0,dx,dy);'
  39.  
  40. /* Write labels for angle */
  41.  
  42.         if dx>=0 then
  43.             'plptex(dx,dy,dx,dy,-0.15,theta);'
  44.         else
  45.             'plptex(dx,dy,minusdx,minusdy,1.15,theta);'
  46.         endif
  47.       end i
  48.  
  49. /* Draw the graph */
  50.  
  51.       do i=1 to 181
  52.         r=sin(dtr*5.0*(i-1))
  53.         x.i=r*x0.i
  54.         y.i=r*y0.i
  55.       end i
  56.       'plline(181,x,y);'
  57.  
  58.       'plmtex("t",2.0,0.5,0.5,"\frPLPLOT Example 3 - r(\gh)=sin 5\gh");'
  59.  
  60. /* Close the plot at end */
  61.  
  62.       'plend();'
  63.  
  64. exit 0
  65.